package leetcode.code0205;

import leetcode.IDebug;
import leetcode.helper.HelpDebug;

public class Solution implements IDebug {

	public boolean isIsomorphic(String s, String t) {
		char[] cs1 = s.toCharArray();
		char[] cs2 = t.toCharArray();
		char[] map1 = new char[256];
		char[] map2 = new char[256];
		int len = s.length();
		for (int i = 0; i < len; i++) {
			char c1 = cs1[i], c2 = cs2[i];
			if ((map1[c1] != 0 && map1[c1] != c2) || (map2[c2] != 0 && map2[c2] != c1)) {
				return false;
			}
			map1[c1] = c2;
			map2[c2] = c1;
		}
		return true;
	}

	@Override
	public void debug1() {
		HelpDebug.compare(true, this.isIsomorphic("paper", "title"));

	}

	@Override
	public void debug2() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug3() {
		// TODO Auto-generated method stub

	}

	@Override
	public void debug4() {
		// TODO Auto-generated method stub

	}

	public static void main(String[] args) {
		Solution so = new Solution();
		so.debug1();
		so.debug2();
		so.debug3();
		so.debug4();
		char c =' ';
		System.out.println((int)c);
	}

}
